
function GoodsList(box){
	this.oBox=box;
	this.oImg=$(".gods-img",this.oBox)[0];
	this.price=$(".goods-price",this.oBox)[0];
	this.title=$(".goods-title",this.oBox)[0];
	this.del=$(".goods-del",this.oBox)[0];
	this.gouwuche=$(".icon-gouwuche",this.oBox)[0];
	var _this=this;
	this.gouwuche.onclick=function(){
		_this.pushcar()
	}	
}
GoodsList.prototype.pushcar=function(){
	var code=this.data.goodscode;
	var status=getCookie("status");
	if(status){
		var gouwuche=getCookie(status+"gouwuche");
		if(gouwuche){
			setCookie(status+"gouwuche",gouwuche+"?"+code,3,"/");
		}else{
			setCookie(status+"gouwuche",code,3,"/");
		}
		testgouwuche();
		actionTip("您选的商品已添加进购物车");
		console.log(getGoodsCode())
	}else{
		actionTip("请先登录");
	}
}
GoodsList.prototype.write=function(){
	this.oImg.src=this.data.img;
	this.title.innerHTML=this.data.title;
	this.price.innerHTML=this.data.price;
	this.del.innerHTML=this.data.del;
}

window.onload=function(){
	serach();
	Testsign();//检测登录状态
	actionSerach();//搜索框效果
	actionBrandSeries();//左侧导航效果
	actionKefu();//右侧客服电话效果
	actionScroll();//右侧回到顶部效果
	serach();
	var naa=$("#sernone").innerHTML;
	var goods=$("#goods1");
	var aDatas=getserach();
	var str1=""
	for(var i=0;i<aDatas.length;i++){
		str1=str1+naa;
	}
	goods.innerHTML=str1;
	var aGoods=$(".one-goods",goods);
	for(var i=0;i<aDatas.length;i++){
		var Box=new GoodsList(aGoods[i]);
		Box.data=aDatas[i];
		Box.write();
	}
	totles.innerHTML=aDatas.length;
}
